Skip to content

Add Lua.pushExternalString - #237

Merged
natecraddock merged 1 commit into
mainfrom
pushexternal
Oct 28, 2026
Merged

natecraddock merged 1 commit into
mainfrom
pushexternal

Conversation

@natecraddock

Copy link
Copy Markdown
Owner

Closes #235

Only for Lua 5.5. External strings are not owned by Lua.
@natecraddock

Copy link
Copy Markdown
Owner Author

@robbielyman I think this one is pretty straightforward. Any thoughts before I merge?

@robbielyman

Copy link
Copy Markdown
Collaborator

Looks good to me! One question I had: since the Lua 5.5 function takes a length parameter, would it be better to allow []const u8 instead of [:0]const u8?

@natecraddock

Copy link
Copy Markdown
Owner Author

The reference manual mentions the string should have a zero at the end, so I think Lua requires it to be null terminated for some reason

@robbielyman

Copy link
Copy Markdown
Collaborator

Ahh ok. I guess it is true that toString() is supposed to return a null-terminated string, even when you use the variant that takes a length parameter, so I'd guess it's probably for that.

If that's the case, it looks good to merge to me! I just notice the checkSupport function that must have been added in the past couple months too, love that.

@natecraddock
natecraddock merged commit bf2fb9a into main Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add lua_pushexternalstring

2 participants